<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>系统配置</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">

    <link rel="stylesheet" href="./css/bootstrap.min.css">
    <link rel="stylesheet" href="./css/common.css">
    <link rel="stylesheet" href="./css/admin.css">
    <link rel="stylesheet" href="./css/iconfont.css">
    <link rel="stylesheet" href="./css/bootstrap-table.css">
    <script src="./js/jquery.min.js"></script>
    <script src="./js/bootstrap.min.js"></script>
    <script src="./js/iconfont.js"></script>
    <script src="./js/bootstrap-table.js"></script>

</head>

<body class="inside-header inside-aside ">
    <div id="main" role="main">
        <div class="tab-content tab-addtabs">
            <div id="content">
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <section class="content-header hide">
                            <h1>
                                控制台
                                <small>Control panel</small>
                            </h1>
                        </section>
                        <!-- RIBBON -->
                        <div id="ribbon">
                            <ol class="breadcrumb pull-left">
                                <li>
                                    <a href="dashboard" class="addtabsit">
                                        <i class="fa fa-dashboard"></i> 控制台</a>
                                </li>
                            </ol>
                            <ol class="breadcrumb pull-right">
                                <li>
                                    <a href="javascript:;" data-url="general">常规管理</a>
                                </li>
                                <li>
                                    <a href="javascript:;" data-url="general/attachment">附件管理</a>
                                </li>
                            </ol>
                        </div>
                        <!-- END RIBBON -->
                        <div class="content">
                            <div class="panel panel-default panel-intro">
                                <div class="panel-body">
                                    <div id="myTabContent" class="tab-content">
                                        <div class="tab-pane fade active in" id="one">
                                            <div class="widget-body no-padding">
                                                <div id="toolbar" class="toolbar">
                                                    <a href="javascript:;" class="btn btn-primary btn-refresh">
                                                        <i class="fa fa-refresh"></i>
                                                    </a>
                                                    <a href="javascript:;" class="btn btn-success btn-add">
                                                        <i class="fa fa-plus"></i> 添加</a>
                                                    <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled">
                                                        <i class="fa fa-pencil"></i> 编辑</a>
                                                    <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled">
                                                        <i class="fa fa-trash"></i> 删除</a>
                                                    <div class="dropdown btn-group">
                                                        <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown">
                                                            <i class="fa fa-cog"></i> 更多</a>
                                                        <ul class="dropdown-menu text-left" role="menu">
                                                            <li>
                                                                <a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal">
                                                                    <i class="fa fa-eye"></i> 设为正常</a>
                                                            </li>
                                                            <li>
                                                                <a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden">
                                                                    <i class="fa fa-eye-slash"></i> 设为隐藏</a>
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div>
                                                <table id="goods">

                                                </table>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>


        /*数据json*/
        var json = '';
        /*初始化table数据*/
        $(function () {
            $("#goods").bootstrapTable({
                showToggle: true,
                search: true,
                showColumns: true,
                checkboxHeader: true,
                exportType : true, //是否显示导出按钮
                exportDataType : "selected", //basic'导出当前页, 'all'导出全部, 'selected'导出选中项.       
                sortStable: true,
                pagination: true,
                onlyInfoPagination: true,
                classes: 'table table-hover table-striped table-bordered',
                sortOrder: 'desc',
                toolbar: '#toolbar',
                dataField: "row", //指定id
                columns: [{
                    checkbox: true,
                }, {
                    field: 'id',
                    title: 'ID'
                }, {
                    field: 'pid',
                    title: '父id'
                }, {
                    field: 'name',
                    title: '类名'
                }, {
                    field: 'description',
                    title: '描述'
                }, {
                    field: 'flag',
                    title: '权重'
                }, {
                    field: 'keywords',
                    title: '标签'
                }, {
                    field: 'status',
                    title: '状态'
                }, {
                    field: 'operator',
                    title: '操作人'
                }, {
                    field: 'create_time',
                    title: '创建时间'
                }, {
                    field: 'updated_time',
                    title: '更新时间'
                }, {
                    title: '操作',
                    field: 'Id',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var e = '<a class="btn btn-xs btn-success btn-detail" href="javascript:;" onclick="edit(' + row.id + ')">编辑</a> ';
                        var d = '<a class="btn btn-xs btn-danger btn-detail" href="javascript:;" onclick="del(' + row.id + ')">删除</a> ';
                        return e + d;
                    }
                }
                ],
                data: json
            });
        });
        function fun(value, row, index) {
            /*处理数据*/
            return "<a class='btn btn-xs btn-success btn-detail' href='javascript:;' onclick='editRow(this)'>编辑</a>&nbsp;&nbsp;<a href='javascript:;' class='btn btn-xs btn-danger btn-detail' onclick='deleteRow(event)'>删除</a>";
        };

        $('.btn-add').click(function () {
            layer.open({
                type: 2,
                title: '添加',
                fix: false,
                maxmin: true,
                shadeClose: true,
                area: ['800px', '500px'],
                content: "{:url('admin/category/add')}",
                end: function () {
                    layer.tips('Hi', '#about', { tips: 1 })
                }
            });
        });
        function edit(id) {
            var url = "{:url('admin/category/edit')}";
            layer.open({
                type: 2,
                title: '添加',
                fix: false,
                maxmin: true,
                shadeClose: true,
                area: ['800px', '500px'],
                content: url.substr(0, url.indexOf('.')) + '/id/' + id,
                end: function () {
                    layer.tips('Hi', '#about', { tips: 1 })
                }
            });
        }
        function editRow() {
            console.log($(this).attr('id'));
        };
    </script>

</body>

</html>